<link rel="stylesheet" href="css/page.css" media="all" />
<link rel="stylesheet" href="css/plist.css" media="all" />
<!-- <link rel="stylesheet" href="css/tao1.css"/> -->
<!-- <style>



.clay .box dl dt.title {
    padding-left: 5%;
    width: 25%;
}
.clay .box dl dd.sapply_did{width:10%;text-align:center;} 
.hidden{visibility:hidden;}
</style> -->
<div class="clay">
	<div class="content">
		<h1><span>产品预订</span></h1>
		<div class="hotcity">
			<span>热门城市：</span>
			<?foreach($hotcitys as $k=>$value){?>
				<a href="plist.html?destid=<?=$k?>"><?=$value?></a>
			<?}
			//echo $count0,"|",$count,"|",$count1;
			?>
		</div>
		<form class="search_form" action="">
			<div class="search">
			<div id="bind_tao">
				<div class="input-wrap">
					<input type="text"  placeholder="请输入景区名称" name="ltitle" id="coop" value="<?=$_REQUEST['ltitle']?>">
					<button type="submit"id="checkSubmitBtn" class="chkbtn">搜&nbsp;&nbsp;&nbsp;索</button>
				</div>
			</div>
				<dl class="p_type">
					<dt>产品类别：</dt>
					<dd>
						<span><a class="<?=$_REQUEST['p_type']==""?"selected":""?>" p_type="" >全部</a></span>
						<?foreach($p_types as $key=>$value){?>
						<span>
							<a class="s_value <?=($p_type==$key)?"selected":""?>" p_type="<?=$key?>"><?=$value?></a>
						</span>
						<?}?>
					</dd>
				</dl>
				<!-- <a id="code" class="fr code" href="?p=<?=$_REQUEST['provinceid']?>&t=<?=urlencode($_REQUEST['topic'])?>&d=<?=$_REQUEST['destid']?>">二维码</a> -->
			<?if($p_type=="B"){?>
				<dl class="startplace">
					<dt>出发地：</dt>
					<dd>
						<span><a class="<?=$_REQUEST['startplace']==""?"selected":""?>" startplace="" >全部</a></span>
						<?foreach($startplaces as $place){?>
						<span>
							<a num="<?=++$num_i?>" class="deep_blue <?if($_REQUEST['startplace']==$place) echo "selected"?>" startplace="<?=$place?>"><?=$place?></a>
						</span>
						<?}?>
					</dd>
				</dl>
				<?if(count($startplaces)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
				<dl class="endplace">
					<dt>目的地：</dt>
					<dd>
						<span><a class="<?=$_REQUEST['endplace']==""?"selected":""?>" endplace="">全部</a></span>
						<?foreach($endplaces as $place){?>
						<span>
							<a num="<?=++$num_i?>" class="deep_blue <?if($_REQUEST['endplace']==$place) echo "selected"?>" endplace="<?=$place?>"><?=$place?></a>
						</span>
						<?}?>
					</dd>
				</dl>
				<?if(count($endplaces)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
				<dl class="rday">
					<dt>游玩天数：</dt>
					<dd>
						<span><a class="<?=$_REQUEST['rday']==""?"selected":""?>" rday="">全部</a></span>
						<span>
							<a class="deep_blue <?=($_REQUEST['rday']==1)?"selected":""?>" rday="1">1日游</a>
						</span>
						<span>
							<a class="deep_blue <?=($_REQUEST['rday']==2)?"selected":""?>" rday="2">2日游</a>
						</span>
						<span>
							<a class="deep_blue <?=($_REQUEST['rday']==3)?"selected":""?>" rday="3">3日游</a>
						</span>
						<span>
							<a class="deep_blue <?=($_REQUEST['rday']==4)?"selected":""?>" rday="4">3日游以上</a>
						</span>
					</dd>
				</dl>
				<p></p>
			<?}else{?>
				<dl class="province">
					<dt>所在省份：</dt>
					<dd>
						<span><a class="<?=$_REQUEST['provinceid']==""?"selected":""?>" provinceid="">全部</a></span>
						<?foreach($province as $provinceid=>$value){?>
						<span><a num="<?=++$num_i?>" class="s_value <?=($_REQUEST['provinceid']==$provinceid)?"selected":""?>" provinceid="<?=$provinceid?>"><?=$value?></a></span>
						<?}?>
					</dd>
				</dl>
				<?if(count($province)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
				<dl class="dest">
					<dt>所在城市：</dt>
					<dd>
						<span><a class="<?=$_REQUEST['destid']==""?"selected":""?>" destid="">全部</a></span>
						<?foreach($destination as $destid=>$value){?>
						<span><a num="<?=++$num_i?>" class="s_value <?=($_REQUEST['destid']==$destid)?"selected":""?>" destid="<?=$destid?>"><?=$value?></a></span>
						<?}?>
					</dd>
				</dl>
				<?if(count($destination)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
				<dl class="topic">
					<dt>旅游主题：</dt>
					<dd>
						<span><a class="<?=$_REQUEST['topic']==""?"selected":""?>" topic="">全部</a></span>
						<?foreach($topics as $value){?>
						<span>
							<a num="<?=++$num_j?>" class="s_value <?=($_REQUEST['topic']==$value)?"selected":""?>" topic="<?=$value?>"><?=$value?></a>
						</span>
						<?}?>
					</dd>
				</dl>
				<?if(count($topics)>8){?><a class="fr more">更多<i>&nbsp;</i></a><?}?>
				<p></p>
			<?}?>
			
		</div>
		</form>	
		<div id="boxWrap" class="boxs">
			<?foreach($r as $sapply_did=>$applylands){
				foreach($applylands as $lid=>$tickets){$n=0;$tnums=count($tickets);?>
			<div class="box <?=$lands[$lid]['self']?>">
				<div class="imgDiv">
					<a><img class="small" src="<?=$lands[$lid]['imgpath']?>" onerror="javascript:this.src='http://www.12301.cc/images/sorry_pic.png'"/></a>
					<div class="bigpic none"><img class="normal" src="<?=$lands[$lid]['imgpath']?>"  onerror="javascript:this.src='http://www.12301.cc/images/sorry_pic.png'"/></div>
				</div>
				<div class="linfo">
					<ul class="">
						<li>
							<a class="title" href="scenicDetail.html?lid=<?=$lid?>&did=<?=$memberID?>" target="_blank" ><?=$lands[$lid]['title']?></a>
							<span class="area"><?=$lands[$lid]['area']?></span>
						</li>
						<li>
							<span class="supply">供应商：<?=$apply_info[$sapply_did]['dname']?> </span>
							<span class="qq">
								<?if($apply_info[$sapply_did]['qq']){?>
								<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=<?=$apply_info[$sapply_did]['qq']?>&site=qq&menu=yes"><img onerror="this.parentNode.removeChild(this)" border="0" src="http://wpa.qq.com/pa?p=2:<?=$apply_info[$sapply_did]['qq']?>:52" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
								<?}?>
							</span>
						</li>
						<li>地址：<?=$lands[$lid]['address']?></li>
					</ul>
				</div>
				<div class="detail">
					<span class="dollar"><i>&yen;</i>
					<strong class="minpricenum"><?=$lands[$lid]['lowprice']/100?></strong></span>起</br>
					<!--<a class="checkBtn" href="scenicDetail.html?lid=<?=$lid?>&did=<?=$memberID?>" target="_blank">散客预订</a>-->
				</div>
				<dl class="header">
					<dt class="id">产品ID</dt>
					<dt class="title">门票类型</dt>
					<!-- <dd class="sapply_did title <?=$_SESSION['sdtype']!=0?"hidden":""?>">产品供应</dd> -->
					<dd class="price">门市价</dd>
					<dd class="price">建议零售价</dd>
					<dd class="price">结算价</dd>
					<dd class="paymethod">支付方式</dd>
					<dd class="operate">操作</dd>
				</dl>
				<?foreach($tickets as $row){$n++?>
				<dl class="ticket <?=$n>3?"none more":""?> <?=($tnums==$n)?"last":""?>">
                    <dt class="id" title="供应商aid|景区lid|门票tid"><?=$row['sapply_did'],'|',$lid,'|',$row['tid']?></dt>
					<dt class="title">
						<a><?=$row['ttitle']?><i class="down_arrow arrow">&nbsp;</i></a>
						
					</dt>
					<!-- <dd class="sapply_did <?=$_SESSION['sdtype']!=0?"hidden":""?>"">
					<?if($lands[$lid]['self']!="self"&&$row['lvl']<2){?>
						<a target="_blank" href="prod_sale.html?pid=<?=$row['pid']?>&lvl=<?=$row['lvl']?>">我要供应</a>
						<?}else{?>--<?}?>
					</dd> -->
					<dd class="price tprice"><i class="dollar">&yen;</i><em class="stnum"><?=$row['tprice']?></em></dd>
					<dd class="price lprice"><i class="dollar">&yen;</i><em class="stnum"><?=$row['uprice']/100?></em></dd>
					<dd class="price jsprice"><strong><i class="dollar">&yen;</i><em class="stnum"><?=$row['jsprice']/100?></em></strong></dd>
					<dd class="paymethod"><a><?=$row['paymethod']?></a></dd>
					<dd class="operate">
						<a class="btn <?=($row['pay']=="0")?"live":""?>" target="_blank" href="productOrder.html?pid=<?=$row['pid']?>&aid=<?=$row['sapply_did']?>">&nbsp;</a>
					</dd>
				</dl>
				<div class="tips none">
					<p>
						<?=$row['notes']?$row['notes']."</br>":""?>
						<span>门票类型：电子票</span>
						<span>有效期限：<?=$row['usetime']?></span>
						<span><?=$row['getaddr']?></span>
					</p>
					<div class="bottom">
						<a>隐藏<i class="arrow up_arrow">&nbsp;</i></a>
					</div>
				</div>
				<?}?>
				<?if($n>3){?>
				<div class="all_ticekt"><a><span>查看所有门票类型</span><i class="arrow down_arrow">&nbsp;</i></a></div>
				<?}?>
			</div>
			<?}
			}?>
			<?if(count($r)==0){?>
			<div class="noresult">
				<?if($_SERVER['QUERY_STRING']){?>
				<h3>没有找到符合条件的产品，你可以:</h3>
				<p>
					试着修改搜索条件<br>
					查看搜索关键词是否有错误的输入
				</p>
				<?}else{?>
				<p>暂无可分销门票产品!</p>
				<?}?>
			</div>
			<?}else{?>
			<div class="page"><?page($count,$currentPage,$pageSize,$order,$by);?></div>
			<?}?>
		</div>
	</div>
</div>
<script type="text/javascript" src="js/global/Url.js"></script>
<script type="text/javascript" src="js/ui/PopWindow.js"></script>
<script>

	//计算最低价
	var getMinprice = function(){
		$("#boxWrap").children(".box").each(function(index,box){
			var item = $(this);
			var prices = item.find(".jsprice em.stnum");
			var min = prices.eq(0).text();
			prices.each(function(i,p){
				var price = $(this).text();
				if(price<min) min = price;
			})
			item.find(".minpricenum").text(min);
		})
	};


	var popBox=new PopWindow();
	$("#code").click(function(){
		var url="call/handle.php"+$(this).attr("href");
		$.ajax({
			"url":url,
			"data":{"from":"index_code"},
			"success":function(href){
				popBox.open("<a class='close'>&nbsp;</a><img src='"+href+"'/>");
				$("#popBox a.close").click(function(){
					popBox.close();
				})
			}
		})
		return false;
	})
	/*景点类别选择框初始化*/
	$(".search dl dd a").each(function(){
		if($(this).hasClass("selected")&&$(this).attr("num")>8){
			$(this).parent().parent().addClass("show");
		}
	})
	$("ul.order a").bind("click",function(){
		var params={};
		params["orderby"]=$(this).attr("order");
		Url.addParams(params);
		window.location=Url.getLocation();
		return false;
	})
	$(".search a.more").click(function(){
		if($(this).prev().find("dd").first().hasClass("show")){
			$(this).prev().find("dd").first().removeClass("show");
		}else{
			$(this).prev().find("dd").first().addClass("show");
		}
		if($(this).hasClass("unfold")){
			$(this).removeClass("unfold");
		}else{
			$(this).addClass("unfold");
		}
	})
	/*景区搜索框js脚本*/
	$(".search dl dd a").bind("click",function(){
		var parent=$(this).parent().parent().parent().attr("class");
		var params={};	
		if(parent.indexOf("province")!=-1){
			params["provinceid"]=$(this).attr("provinceid");
			Url.setParams({"destid":""});
			Url.setParams({"topic":""});
		}
		if(parent.indexOf("dest")!=-1){
			params["destid"]=$(this).attr("destid");
			Url.setParams({"topic":""});
		}
		if(parent.indexOf("topic")!=-1){
			params["topic"]=$(this).attr("topic");
		}
		if(parent.indexOf("p_type")!=-1){
			params["p_type"]=$(this).attr("p_type");
		}
		if(parent.indexOf("startplace")!=-1){
			params["startplace"]=$(this).attr("startplace");
		}
		if(parent.indexOf("endplace")!=-1){
			params["endplace"]=$(this).attr("endplace");
		}
		if(parent.indexOf("rday")!=-1){
			params["rday"]=$(this).attr("rday");
		}
		if(parent.indexOf("priceType")!=-1){
			params["priceType"]=$(this).attr("priceType");
		}
		Url.addParams(params);
		Url.setParams({"currentPage":1});
		window.location=Url.getLocation();
	})
	$("dl.ticket dt.title a").click(function(){
		var iHtml=$(this).find("i").first();
		if(iHtml.hasClass("down_arrow")){
			$(this).parent().parent().next().removeClass("none");
			iHtml.removeClass("down_arrow");
			iHtml.addClass("up_arrow");
		}else{
			$(this).parent().parent().next().addClass("none");
			iHtml.removeClass("up_arrow");
			iHtml.addClass("down_arrow");
		}
	})
	$("div.tips .bottom a").click(function(){
		$(this).parent().parent().prev().find("dt.title a").click();
	});
	$(".all_ticekt a").click(function(){
		var iHtml=$(this).find("i").first();
		if(iHtml.hasClass("down_arrow")){
			$(this).parent().parent().find("dl.more").removeClass("none");
			iHtml.removeClass("down_arrow");
			iHtml.addClass("up_arrow");
			$(this).children().first().text("收起所有门票类型");
		}else{
			$(this).parent().parent().find("dl.more").addClass("none");
			$(this).parent().parent().find("dl.more").next().addClass("none");
			iHtml.removeClass("up_arrow");
			iHtml.addClass("down_arrow");
			$(this).children().first().text("查看所有门票类型");
		}
	});
	$("a.show_all").click(function(){
		var table=$(this).parent().parent().parent();
		if($(this).hasClass("show_all")){
			table.find(".show_more").removeClass("display_none");
			$(this).html("收起全部");
			$(this).removeClass("show_all");
		}else{
			table.find(".show_more").addClass("display_none");
			$(this).html("显示全部");
			$(this).addClass("show_all");
		}
		return false;
	});
	(function(){
		var t;
		$(".imgDiv .small").mouseover(function(){
			var imgDiv=$(this).parent().next()
			t=setTimeout(function(){
				imgDiv.removeClass("none");
				imgDiv.children().first().animate({width:"350px"});},"500");
		}).mouseout(function(){
			clearTimeout(t);
			$(this).parent().next().addClass("none");
			$(this).parent().next().children().first().width(0);
		});
		getMinprice();
	})();
	
	
</script>